<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>权限组编辑</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
	.layui-input-block{margin-left:130px!important}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
			 <div class="layui-card-header">
				{if !$info['id']}<i class="fa fa-plus"></i> 新增权限组{else}<i class="fa fa-pencil"></i> 编辑权限组{/if}
			 <i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i></div>
				<div class="layui-card-body" pad15>
					<div class="layui-form form-label-w6" lay-filter="">
						<input type="hidden" name="info[id]" value="{$info['id']}"/>
						<div class="layui-form-item">
							<label class="layui-form-label">名称：</label>
							<div class="layui-input-inline">
								<input type="text" name="info[name]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info.name}">
							</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">权重：</label>
							<div class="layui-input-inline">
								<input type="text" name="info[sort]" class="layui-input" value="{$info['sort']}">
							</div>
							<div class="layui-word-aux layui-clear">权重越高代表权限越大，低权重的权限组的用户无法添加高权重的权限组的用户</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">备注：</label>
							<div class="layui-input-inline">
								<input type="text" name="info[remark]" class="layui-input" value="{$info['remark']}">
							</div>
						</div>
						{if $thisuser_mdid == 0}
						<div class="layui-form-item">
							<label class="layui-form-label">门店：</label>
							<div class="layui-input-inline" style="width:800px">
								<input type="radio" name="info[mdid]" value="0" {if !$info['id'] || $info['mdid']==0}checked{/if} title="全部">
								{foreach $mendianlist as $md}<input type="radio" name="info[mdid]" value="{$md.id}" {if $md['id']==$info['mdid']}checked{/if} title="{$md.name}">{/foreach}
							</div>
							<div class="layui-word-aux layui-clear">指定门店后，该权限组的管理员的订单权限只能看到指定门店的订单</div>
						</div>
						{elseif !$info['id']}
						<input type="hidden" value="info[mdid]" value="{$thisuser_mdid}"/>
						{/if}
						{if $thisuser_showtj == 1}
						<div class="layui-form-item">
							<label class="layui-form-label">首页数据统计：</label>
							<div class="layui-input-inline">
								<input type="radio" name="info[showtj]" value="1" {if $info['showtj']==1}checked{/if} title="显示"/>
								<input type="radio" name="info[showtj]" value="0" {if $info['showtj']==0}checked{/if} title="不显示"/>
							</div>
						</div>
						{elseif !$info['id']}
						<input type="hidden" value="info[showtj]" value="0"/>
						{/if}
						

						{include file="public/user_auth"/}
						<div class="layui-form-item">
							<div class="layui-input-block">
								<button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</div>
    </div>
  </div>
	{include file="public/js"/}
	<script>
	layui.form.on('checkbox(checkall_all)',function(data){
		if(data.elem.checked){
			$(data.elem).parent().parent().find('input[type=checkbox]').prop('checked',true);
		}else{
			$(data.elem).parent().parent().find('input[type=checkbox]').prop('checked',false);
		}
		layui.form.render('checkbox'); 
	})
	layui.form.on('checkbox(checkall)',function(data){
		if(data.elem.checked){
			$(data.elem).parent().parent().find('input[type=checkbox]').prop('checked',true);
		}else{
			$(data.elem).parent().parent().find('input[type=checkbox]').prop('checked',false);
		}
		layui.form.render('checkbox'); 
	})
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		var index = layer.load();
		$.post("{:url('save')}",obj.field,function(data){
			layer.close(index);
			dialog(data.msg,data.status);
			if(data.status == 1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload()
				},1000)
			}
		})
	})
	
  </script>
	{include file="public/copyright"/}
</body>
</html>